//
//  ArticleModel.m
//  DebugDemo
//
//  Created by XFB on 2018/11/23.
//  Copyright © 2018年 ZhouCheng. All rights reserved.
//

#import "ArticleModel.h"
#import "HTTPClient.h"

@implementation ArticleModel

+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{@"id" : @"ID"};
}

+ (NSDictionary *)mj_objectClassInArray
{
    return @{@"default_pics" : [Article_Default_Pics class]};
}

+ (void)getArticleDataWithParameter:(NSDictionary *)parameter
                            success:(SuccessResultHandler)success
                            failure:(FailureResultHandler)failure
{
    NSString *urlString = @"http://api.test.xfb315.com/v4/article/article_index";

    [HTTPClient getURL:urlString parameter:parameter success:^(id _Nonnull responseObject) {

        if (responseObject == nil) {
            success(nil);
        }
        
        ResultInfo *resultInfo = [ResultInfo convertResponseToResultInfo:responseObject];
        NSLog(@"%@", resultInfo);
        success(resultInfo);
    } failure:^(NSError * _Nonnull error) {
        failure(error);
    }];
}

@end

@implementation Article_Default_Pics

+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{@"picsID" : @"id"};
}

@end
